import { observable, action } from 'mobx'
import Taro from '@tarojs/taro'
import {newsUri,shopUri} from "../api/api"
import { get } from "../api/fetch"

class Store {
  @observable isShow = true;
  @observable newsData=[];
  @observable shopData=[];
  @observable liveData=[];
  @observable hotwords=[];
  @observable keywords='';
  @observable show=true;
  @observable userInfo = {};
  @observable category = [];
  @action.bound setNewsData(newsData){
    this.newsData = newsData
  }
  @action.bound clearNewsData(){
    this.startIndex=-10;
    this.newsData.length=0;
  }
  @action.bound setKeywords(keywords){
    this.keywords = keywords
  }
  @action.bound clearKeywords(keywords){
    this.keywords = ''
  }
  @action.bound updateUserInfo(userinfo){
    this.userInfo = userinfo
  }
  @action.bound hiddenButton(){
    this.show=false;
  }
  @action.bound showButton(){
    this.show=true;
  }
  @action.bound showSpinner(){
    this.isShow = true;
  }
  @action.bound hideSpinner(){
    this.isShow = false;
  }
  @action.bound getHotwords(){
    this.hotwords=['筷子腿','口罩半面妆', '复工穿搭', '电档饼美食', '飘柔', '香奈儿196', '69香奈儿'];
  }
  @action.bound setShopData(shopData) {
    this.shopData = shopData
  }
  @action.bound clearShopData(){
    this.shopData.length=0;
  }
}
export default new Store()
